#ifndef __ADMIN_H__
#define __ADMIN_H__

/*头文件*/
//------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//------------------------------------


/*宏定义*/
//------------------------------------
#define CODE_SIZE 16
#define USER_SIZE 12
#define LOTTERY_SIZE 5
#define LOTTERY_WIN_SIZE 3
#define ARR_SIZE 3
//------------------------------------


/*结构体*/
//------------------------------------
#pragma pack(4)

typedef struct
{
	int balance;  //余额
	char name[USER_SIZE];
	char pwd[CODE_SIZE];
} xUser, *pUser;

typedef struct
{
	char name[USER_SIZE];
	char lottery_num[LOTTERY_SIZE];
	int id; 
	int issue_version;
	int issue_status;
	int prize_status;
	int prize_gain;
} xLottery, *pLottery;

typedef struct Node
{
	void* data;
	struct Node* next;
}xNode,*pNode;

#pragma pack()
//------------------------------------


/*文件及文件指针定义*/
//------------------------------------
extern FILE *f_user_info, *f_lottery_info, *f_lottery_man, *f_prize_pool;
extern char* user_info;
extern char* lottery_info;
extern char* lottery_man;
extern char* prize_pool;
//------------------------------------



/*函数声明*/
//------------------------------------
void menu(void);
void issue_version(void);
void load_users(pNode head);
void load_lottery(pNode head, int mode);
void show_users(pNode head);
void show_lottery(pNode head);
void free_list(pNode head);
void free_list_arr(pNode list_arr[],int len);
int compare_balance(pNode user1, pNode user2);
int compare_prize_status(pNode lottery1, pNode lottery2);
void sort(pNode head,int (*comp)(pNode ,pNode ));
void pool_recharge(void);

//------------------------------------


/*全局变量声明*/
//------------------------------------
extern int  QIHAO, perPrice_lottery, STATE;
//------------------------------------


#endif
